from sqlalchemy.orm import scoped_session, sessionmaker
import base

from .Train import *
from .Stop import *
from .Station import *
from .RawData import *
from .ResultRecord import *
from zope.sqlalchemy.datamanager import ZopeTransactionExtension

DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Session = scoped_session(sessionmaker(autoflush=True))

metadata = base.Base.metadata

def getSession():
    return DBSession()